package com.example.autumn.entity;

import com.baomidou.mybatisplus.activerecord.Model;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.IdType;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import javax.persistence.*;
import java.io.Serializable;

/**
 * <p>
 *
 * </p>
 *
 * @author Liao run
 * @since 2022-08-31
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@Entity(name = "user_1")
public class User extends Model<User> {

    private static final long serialVersionUID = 1L;

    // 必须是none才能自己生成
    @TableId(type = IdType.NONE)
    @Id
//    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;


    @ApiModelProperty(value = "用户名", example = "root")
    @Column(columnDefinition = "varchar(255) not null comment '用户名'")
    private String username;

    @ApiModelProperty(value = "密码", example = "123456")
    @Column(columnDefinition = "varchar(255) not null comment '密码'")
    private String password;


    @Override
    protected Serializable pkVal() {
        return this.id;
    }

}
